package com.shengqin.utils;

import com.shengqin.common.enums.GradeEnum;
import com.shengqin.entity.School;
import com.shengqin.pojo.grade.GradeModel;

import java.util.ArrayList;
import java.util.List;

public class GradeUtil {
    public static List<GradeModel> getGradeList(String schoolType){
        List<GradeModel> gradeEnumList = new ArrayList<>();
        if (schoolType.contains("1")) {
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE11.getId(),GradeEnum.GRADE11.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE12.getId(),GradeEnum.GRADE12.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE13.getId(),GradeEnum.GRADE13.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE14.getId(),GradeEnum.GRADE14.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE15.getId(),GradeEnum.GRADE15.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE16.getId(),GradeEnum.GRADE16.getName()));
        }
        if (schoolType.contains("2")) {
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE21.getId(),GradeEnum.GRADE21.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE22.getId(),GradeEnum.GRADE22.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE23.getId(),GradeEnum.GRADE23.getName()));
        }
        if (schoolType.contains("3")) {
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE31.getId(),GradeEnum.GRADE31.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE32.getId(),GradeEnum.GRADE32.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE33.getId(),GradeEnum.GRADE33.getName()));
        }
        if (schoolType.contains("4")) {
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE41.getId(),GradeEnum.GRADE41.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE42.getId(),GradeEnum.GRADE42.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE43.getId(),GradeEnum.GRADE43.getName()));
            gradeEnumList.add(new GradeModel(GradeEnum.GRADE44.getId(),GradeEnum.GRADE44.getName()));
        }
        return gradeEnumList;
    }

    public static String getGradeName(Integer gradeId){
        String gradeName = "";
        switch (gradeId){
            case 11:
                gradeName = GradeEnum.GRADE11.getName();
                break;
            case 12:
                gradeName = GradeEnum.GRADE12.getName();
                break;
            case 13:
                gradeName = GradeEnum.GRADE13.getName();
                break;
            case 14:
                gradeName = GradeEnum.GRADE14.getName();
                break;
            case 15:
                gradeName = GradeEnum.GRADE15.getName();
                break;
            case 16:
                gradeName = GradeEnum.GRADE16.getName();
                break;
            case 21:
                gradeName = GradeEnum.GRADE21.getName();
                break;
            case 22:
                gradeName = GradeEnum.GRADE22.getName();
                break;
            case 23:
                gradeName = GradeEnum.GRADE23.getName();
                break;
            case 31:
                gradeName = GradeEnum.GRADE31.getName();
                break;
            case 32:
                gradeName = GradeEnum.GRADE32.getName();
                break;
            case 33:
                gradeName = GradeEnum.GRADE33.getName();
                break;
            case 41:
                gradeName = GradeEnum.GRADE41.getName();
                break;
            case 42:
                gradeName = GradeEnum.GRADE42.getName();
                break;
            case 43:
                gradeName = GradeEnum.GRADE43.getName();
                break;
            case 44:
                gradeName = GradeEnum.GRADE44.getName();
                break;
            default:
                break;
        }
        return gradeName;
    }

}
